]> dgit.raspbian.org Git - gnome-shell.git/commit
loginManager: Use systemd session auto object to get session ID
authorAlessandro Bono <alessandro.bono369@gmail.com>
Thu, 30 Oct 2025 10:47:17 +0000 (11:47 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 24 Nov 2025 13:42:59 +0000 (14:42 +0100)
commit27c1fdd4e651d9dff07c35af32868fc8098719a1
tree97e4946b24a281853374be09c1e2d0bca40e0fd4
parentf6c944a82274c09e65b51388e39f54b0028f98d1
loginManager: Use systemd session auto object to get session ID

Relying on the Display property is buggy when the gdm user spawns more than
one gnome-shell instance.
```
$ loginctl
SESSION  UID USER   SEAT  LEADER CLASS         TTY   IDLE SINCE
     11   42 gdm    -     11778  manager-early -     no   -
    c20   42 gdm    seat0 34313  greeter       tty1  yes  17h ago
    c21   42 gdm    -     34938  greeter       -     no   -
    c22   42 gdm    -     35693  greeter       -     no   -
```

From the logs:
```
$ journalctl -b | grep "Will monitor"
[...]
Oct 29 15:14:59 gnome-shell[34961]: Will monitor session c20
Oct 29 15:22:57 gnome-shell[35716]: Will monitor session c20
Oct 29 15:22:58 gnome-shell[35716]: Will monitor session c20
```

Use the systemd session auto object for getting the session id. We can't return
directly the session proxy created from it because it won't emit signals. From
the documentation[1]:
```
Signals are only emitted on objects referencing a specific session ID not on the
"/org/freedesktop/login1/session/self" or "/org/freedesktop/login1/session/auto"
convenience objects, as they can only be dereferenced relative to a method caller.
```

[1] https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.login1.html

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3942>
(cherry picked from commit 5db3a2b7bcfebdcc71038df890ae44308c98b95e)
js/misc/loginManager.js